import React from "react";

class HoverCounter extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      count: 0,
    };
  }

  handleChange = () => {
    this.setState({
      count: this.state.count + 1,
    });
  };

  render() {
    return (
      <h1 onMouseEnter={this.handleChange}>
        鼠标滑过了标题{this.state.count}次
      </h1>
    );
  }
}

export default HoverCounter;
